package org.hong.monkey.util

/**
 * Exception thrown when there is an exception in
 * executing the callback in TaskCompletionListener.
 */
private[monkey]
class TaskCompletionListenerException(errorMessages: Seq[String]) extends Exception {

  override def getMessage: String = {
    if (errorMessages.size == 1) {
      errorMessages.head
    } else {
      errorMessages.zipWithIndex.map { case (msg, i) => s"Exception $i: $msg" }.mkString("\n")
    }
  }
}
